package com.wen.tian.controller;

import com.wen.tian.enums.CommonEnum;
import com.wen.tian.exception.CustomException;
import com.wen.tian.pojo.SysUser;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * 主页
 *
 * @author tww
 * ClassName: IndexController.java、
 * createTime: 2021年01月02日 15:57:01
 **/
@Controller
public class IndexController extends BaseController {

    @GetMapping("index")
    public String toIndex(Model model) {
        SysUser sysUser = getSysUser();
        if (null == sysUser) {
            throw new CustomException(CommonEnum.USER_NOT_EXEIT);
        }
        model.addAttribute("userName", sysUser);
        return "index";
    }

}
